Label		Mnemonic		Operands		Comments
; kbd.asm
KBD		.ORIG			0x3000

		LADR			$R3, STACK
		LADR			$R6, COUNT
		LADR			$R7, LOOP1
		LADR			$R8, DONE1
		LDW			$R5, $R6		;load the value at count into $R5
LOOP1		IN			KEY			;take keyboard char input
		STB			$R0, $R3		;store on the stack
		ADDI			$R3, #1			;increment stack ptr
		SUBI			$R5, #1			;decrement counter
		BRz			$R8
		Br			$R7
DONE1		LDW			$R5, $R6		;reload pointers and counter
		LADR			$R7, LOOP2		
		LADR			$R8, DONE2
LOOP2		SUBI			$R3, #1			;decrement stack ptr
		LDB			$R0, $R3		;load from stack
		OUT			VID			;print char on screen
		SUBI			$R5, #1			;decrement counter
		BRz			$R8
		Br			$R7
DONE2		HALT
COUNT		.FILL			#10
STACK		.RSW			10			;Reserve 10 words of space for the ascii stack
